3.5.39 \(\int \frac {(a+a \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx\) [439]

Optimal. Leaf size=92 \[ -\frac {a^2 (c-2 d) x}{d^2}+\frac {2 a^2 (c-d)^2 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \sqrt {c^2-d^2} f}-\frac {a^2 \cos (e+f x)}{d f} \]

[Out]

-a^2*(c-2*d)*x/d^2-a^2*cos(f*x+e)/d/f+2*a^2*(c-d)^2*arctan((d+c*tan(1/2*f*x+1/2*e))/(c^2-d^2)^(1/2))/d^2/f/(c^
2-d^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.14, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {2825, 2814, 2739, 632, 210} \begin {gather*} \frac {2 a^2 (c-d)^2 \text {ArcTan}\left (\frac {c \tan \left (\frac {1}{2} (e+f x)\right )+d}{\sqrt {c^2-d^2}}\right )}{d^2 f \sqrt {c^2-d^2}}-\frac {a^2 x (c-2 d)}{d^2}-\frac {a^2 \cos (e+f x)}{d f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + a*Sin[e + f*x])^2/(c + d*Sin[e + f*x]),x]

[Out]

-((a^2*(c - 2*d)*x)/d^2) + (2*a^2*(c - d)^2*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/(d^2*Sqrt[c^2 -
d^2]*f) - (a^2*Cos[e + f*x])/(d*f)

Rule 210

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^(-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])
], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 2739

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[2*(e/d), Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2825

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b^2
)*(Cos[e + f*x]/(d*f)), x] + Dist[1/d, Int[Simp[a^2*d - b*(b*c - 2*a*d)*Sin[e + f*x], x]/(c + d*Sin[e + f*x]),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps

\begin {align*} \int \frac {(a+a \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx &=-\frac {a^2 \cos (e+f x)}{d f}+\frac {\int \frac {a^2 d-a^2 (c-2 d) \sin (e+f x)}{c+d \sin (e+f x)} \, dx}{d}\\ &=-\frac {a^2 (c-2 d) x}{d^2}-\frac {a^2 \cos (e+f x)}{d f}+\frac {\left (a^2 (c-d)^2\right ) \int \frac {1}{c+d \sin (e+f x)} \, dx}{d^2}\\ &=-\frac {a^2 (c-2 d) x}{d^2}-\frac {a^2 \cos (e+f x)}{d f}+\frac {\left (2 a^2 (c-d)^2\right ) \text {Subst}\left (\int \frac {1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{d^2 f}\\ &=-\frac {a^2 (c-2 d) x}{d^2}-\frac {a^2 \cos (e+f x)}{d f}-\frac {\left (4 a^2 (c-d)^2\right ) \text {Subst}\left (\int \frac {1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac {1}{2} (e+f x)\right )\right )}{d^2 f}\\ &=-\frac {a^2 (c-2 d) x}{d^2}+\frac {2 a^2 (c-d)^2 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \sqrt {c^2-d^2} f}-\frac {a^2 \cos (e+f x)}{d f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.27, size = 130, normalized size = 1.41 \begin {gather*} -\frac {a^2 \left (-2 (c-d)^2 \tan ^{-1}\left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )+\sqrt {c^2-d^2} ((c-2 d) (e+f x)+d \cos (e+f x))\right ) (1+\sin (e+f x))^2}{d^2 \sqrt {c^2-d^2} f \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )^4} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Sin[e + f*x])^2/(c + d*Sin[e + f*x]),x]

[Out]

-((a^2*(-2*(c - d)^2*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]] + Sqrt[c^2 - d^2]*((c - 2*d)*(e + f*x) +
 d*Cos[e + f*x]))*(1 + Sin[e + f*x])^2)/(d^2*Sqrt[c^2 - d^2]*f*(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])^4))

________________________________________________________________________________________

Maple [A]
time = 0.33, size = 105, normalized size = 1.14

method result size
derivativedivides \(\frac {2 a^{2} \left (\frac {\left (c^{2}-2 c d +d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}-\frac {\frac {d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (c -2 d \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d^{2}}\right )}{f}\) \(105\)
default \(\frac {2 a^{2} \left (\frac {\left (c^{2}-2 c d +d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}-\frac {\frac {d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (c -2 d \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{d^{2}}\right )}{f}\) \(105\)
risch \(-\frac {a^{2} x c}{d^{2}}+\frac {2 a^{2} x}{d}-\frac {a^{2} {\mathrm e}^{i \left (f x +e \right )}}{2 d f}-\frac {a^{2} {\mathrm e}^{-i \left (f x +e \right )}}{2 d f}+\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right ) c}{\left (c +d \right ) f \,d^{2}}-\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right )}{\left (c +d \right ) f d}-\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {-i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right ) c}{\left (c +d \right ) f \,d^{2}}+\frac {\sqrt {-\left (c +d \right ) \left (c -d \right )}\, a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {-i c +\sqrt {-\left (c +d \right ) \left (c -d \right )}}{d}\right )}{\left (c +d \right ) f d}\) \(303\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*sin(f*x+e))^2/(c+d*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

2/f*a^2*((c^2-2*c*d+d^2)/d^2/(c^2-d^2)^(1/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2))-1/d^2*(d
/(1+tan(1/2*f*x+1/2*e)^2)+(c-2*d)*arctan(tan(1/2*f*x+1/2*e))))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*d^2-4*c^2>0)', see `assume?`
 for more de

________________________________________________________________________________________

Fricas [A]
time = 0.38, size = 307, normalized size = 3.34 \begin {gather*} \left [-\frac {2 \, a^{2} d \cos \left (f x + e\right ) + 2 \, {\left (a^{2} c - 2 \, a^{2} d\right )} f x + {\left (a^{2} c - a^{2} d\right )} \sqrt {-\frac {c - d}{c + d}} \log \left (\frac {{\left (2 \, c^{2} - d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2} + 2 \, {\left ({\left (c^{2} + c d\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right ) + {\left (c d + d^{2}\right )} \cos \left (f x + e\right )\right )} \sqrt {-\frac {c - d}{c + d}}}{d^{2} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2}}\right )}{2 \, d^{2} f}, -\frac {a^{2} d \cos \left (f x + e\right ) + {\left (a^{2} c - 2 \, a^{2} d\right )} f x + {\left (a^{2} c - a^{2} d\right )} \sqrt {\frac {c - d}{c + d}} \arctan \left (-\frac {{\left (c \sin \left (f x + e\right ) + d\right )} \sqrt {\frac {c - d}{c + d}}}{{\left (c - d\right )} \cos \left (f x + e\right )}\right )}{d^{2} f}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="fricas")

[Out]

[-1/2*(2*a^2*d*cos(f*x + e) + 2*(a^2*c - 2*a^2*d)*f*x + (a^2*c - a^2*d)*sqrt(-(c - d)/(c + d))*log(((2*c^2 - d
^2)*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2 + 2*((c^2 + c*d)*cos(f*x + e)*sin(f*x + e) + (c*d + d^2)*c
os(f*x + e))*sqrt(-(c - d)/(c + d)))/(d^2*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2)))/(d^2*f), -(a^2*d*
cos(f*x + e) + (a^2*c - 2*a^2*d)*f*x + (a^2*c - a^2*d)*sqrt((c - d)/(c + d))*arctan(-(c*sin(f*x + e) + d)*sqrt
((c - d)/(c + d))/((c - d)*cos(f*x + e))))/(d^2*f)]

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 3709 vs. \(2 (76) = 152\).
time = 180.78, size = 3709, normalized size = 40.32 \begin {gather*} \text {Too large to display} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))**2/(c+d*sin(f*x+e)),x)

[Out]

Piecewise((zoo*x*(a*sin(e) + a)**2/sin(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), (2*a**2*d**2*f*x*tan(e/2 + f*x/2)*
*3/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/
2)) - a**2*d**2*f*x*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2
)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 2*a**2*d**2*f*x*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3
*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) - a**2*d**2*f*x/(d**3*f*tan(e/2 +
 f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 4*a**2*d**2*ta
n(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2
- f*(d**2)**(3/2)) - 2*a**2*d**2*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d
**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 4*a**2*d**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2
+ f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + a**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)**3/
(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2))
 - 2*a**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2
)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + a**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x
/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) - 2*a**2*d*f*x*sqrt(
d**2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**
(3/2)) + 4*a**2*d*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d*
*2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 6*a**2*d*sqrt(d**2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*t
an(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)), Eq(c, -sqrt(d**2))), (2*a**2*d**2*f*
x*tan(e/2 + f*x/2)**3/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)
**2 + f*(d**2)**(3/2)) - a**2*d**2*f*x*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/
2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) + 2*a**2*d**2*f*x*tan(e/2 + f*x/2)/(d**3*f*tan(e/2
 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - a**2*d**2*f*
x/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2
)) + 4*a**2*d**2*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*t
an(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - 2*a**2*d**2*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(
e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) + 4*a**2*d**2/(d**3*f*tan(e/2 + f*x/2)**
3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - a**2*d*f*x*sqrt(d**2)*t
an(e/2 + f*x/2)**3/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2
 + f*(d**2)**(3/2)) + 2*a**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2
 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - a**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)/(d
**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) +
 2*a**2*d*f*x*sqrt(d**2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x
/2)**2 + f*(d**2)**(3/2)) - 4*a**2*d*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e
/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - 6*a**2*d*sqrt(d**2)/(d**3*f*tan(e/2 + f
*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)), Eq(c, sqrt(d**2))
), ((a**2*x*sin(e + f*x)**2/2 + a**2*x*cos(e + f*x)**2/2 + a**2*x - a**2*sin(e + f*x)*cos(e + f*x)/(2*f) - 2*a
**2*cos(e + f*x)/f)/c, Eq(d, 0)), (x*(a*sin(e) + a)**2/(c + d*sin(e)), Eq(f, 0)), ((2*a**2*f*x*tan(e/2 + f*x/2
)**2/(f*tan(e/2 + f*x/2)**2 + f) + 2*a**2*f*x/(f*tan(e/2 + f*x/2)**2 + f) + a**2*log(tan(e/2 + f*x/2))*tan(e/2
 + f*x/2)**2/(f*tan(e/2 + f*x/2)**2 + f) + a**2*log(tan(e/2 + f*x/2))/(f*tan(e/2 + f*x/2)**2 + f) - 2*a**2/(f*
tan(e/2 + f*x/2)**2 + f))/d, Eq(c, 0)), (a**2*c**2*log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)*tan(e/2
+ f*x/2)**2/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) + a**2*c**2*log(tan(e/
2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 +
d**2)) - a**2*c**2*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)*tan(e/2 + f*x/2)**2/(d**2*f*sqrt(-c**2 +
 d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) - a**2*c**2*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 +
d**2)/c)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) - 2*a**2*c*d*log(tan(e/2
+ f*x/2) + d/c - sqrt(-c**2 + d**2)/c)*tan(e/2 ...

________________________________________________________________________________________

Giac [A]
time = 0.46, size = 136, normalized size = 1.48 \begin {gather*} -\frac {\frac {{\left (a^{2} c - 2 \, a^{2} d\right )} {\left (f x + e\right )}}{d^{2}} + \frac {2 \, a^{2}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1\right )} d} - \frac {2 \, {\left (a^{2} c^{2} - 2 \, a^{2} c d + a^{2} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (c\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + d}{\sqrt {c^{2} - d^{2}}}\right )\right )}}{\sqrt {c^{2} - d^{2}} d^{2}}}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="giac")

[Out]

-((a^2*c - 2*a^2*d)*(f*x + e)/d^2 + 2*a^2/((tan(1/2*f*x + 1/2*e)^2 + 1)*d) - 2*(a^2*c^2 - 2*a^2*c*d + a^2*d^2)
*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d^2)))/(sqrt(c^2 -
d^2)*d^2))/f

________________________________________________________________________________________

Mupad [B]
time = 7.68, size = 940, normalized size = 10.22 \begin {gather*} \frac {4\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,\left (c+d\right )}-\frac {a^2\,\cos \left (e+f\,x\right )}{f\,\left (c+d\right )}+\frac {2\,a^2\,c\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d\,f\,\left (c+d\right )}-\frac {2\,a^2\,c^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d^2\,f\,\left (c+d\right )}-\frac {a^2\,c\,\cos \left (e+f\,x\right )}{d\,f\,\left (c+d\right )}+\frac {a^2\,\mathrm {atan}\left (\frac {\left (3\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (-c^4+2\,c^3\,d-2\,c\,d^3+d^4\right )}^{3/2}-2\,c^6\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-2\,c^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (-c^4+2\,c^3\,d-2\,c\,d^3+d^4\right )}^{3/2}+7\,d^6\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+10\,c\,d^5\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+4\,c^5\,d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+4\,c^2\,d^4\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-3\,c^3\,d^3\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-2\,c^4\,d^2\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-9\,c^2\,d^4\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}-12\,c^3\,d^3\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+6\,c^4\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+c\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,{\left (-c^4+2\,c^3\,d-2\,c\,d^3+d^4\right )}^{3/2}+4\,c\,d^5\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}+c^5\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {-c^4+2\,c^3\,d-2\,c\,d^3+d^4}\right )\,1{}\mathrm {i}}{d\,\left (c+d\right )\,\left (3\,c^5\,d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-5\,c\,d^5\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-10\,d^6\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+16\,c\,d^5\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+8\,c^2\,d^4\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+2\,c^3\,d^3\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-8\,c^4\,d^2\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+4\,c^2\,d^4\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-16\,c^3\,d^3\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+6\,c^4\,d^2\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )}\right )\,\sqrt {-\left (c+d\right )\,{\left (c-d\right )}^3}\,2{}\mathrm {i}}{d^2\,f\,\left (c+d\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a*sin(e + f*x))^2/(c + d*sin(e + f*x)),x)

[Out]

(4*a^2*atan(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(f*(c + d)) - (a^2*cos(e + f*x))/(f*(c + d)) + (2*a^2*c*at
an(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(d*f*(c + d)) - (2*a^2*c^2*atan(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/
2)))/(d^2*f*(c + d)) + (a^2*atan(((3*d^2*sin(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(3/2) - 2*c^6*sin(
e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) - 2*c^2*sin(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4
)^(3/2) + 7*d^6*sin(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) + 10*c*d^5*sin(e/2 + (f*x)/2)*(2*c^3*
d - 2*c*d^3 - c^4 + d^4)^(1/2) + 4*c^5*d*sin(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) + 4*c^2*d^4*
cos(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) - 3*c^3*d^3*cos(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c
^4 + d^4)^(1/2) - 2*c^4*d^2*cos(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) - 9*c^2*d^4*sin(e/2 + (f*
x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) - 12*c^3*d^3*sin(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1
/2) + 6*c^4*d^2*sin(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) + c*d*cos(e/2 + (f*x)/2)*(2*c^3*d - 2
*c*d^3 - c^4 + d^4)^(3/2) + 4*c*d^5*cos(e/2 + (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2) + c^5*d*cos(e/2 +
 (f*x)/2)*(2*c^3*d - 2*c*d^3 - c^4 + d^4)^(1/2))*1i)/(d*(c + d)*(3*c^5*d*cos(e/2 + (f*x)/2) - 5*c*d^5*cos(e/2
+ (f*x)/2) - 10*d^6*sin(e/2 + (f*x)/2) + 16*c*d^5*sin(e/2 + (f*x)/2) + 8*c^2*d^4*cos(e/2 + (f*x)/2) + 2*c^3*d^
3*cos(e/2 + (f*x)/2) - 8*c^4*d^2*cos(e/2 + (f*x)/2) + 4*c^2*d^4*sin(e/2 + (f*x)/2) - 16*c^3*d^3*sin(e/2 + (f*x
)/2) + 6*c^4*d^2*sin(e/2 + (f*x)/2))))*(-(c + d)*(c - d)^3)^(1/2)*2i)/(d^2*f*(c + d)) - (a^2*c*cos(e + f*x))/(
d*f*(c + d))

________________________________________________________________________________________